package com.mingqijia.gassafety.console.controller;

import com.gap.basic.base.CommonResponse;
import com.mingqijia.gassafety.shared.utils.commonUtils.PageUtil;
import com.mingqijia.gassafety.webserver.request.OperationLogRequest;
import com.mingqijia.gassafety.webserver.response.OperationLogResponse;
import com.mingqijia.gassafety.webserver.service.OperationLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: gassafety
 * @description:
 * @author: Mr.Wang
 * @create: 2023-02-14 16:58
 **/

@Slf4j
@Api(tags = "操作日志")
@RestController(value = "OperationLogController")
@RequestMapping("/business/v1/operationLog")
public class OperationLogController {

    @Autowired
    OperationLogService operationLogService;

    @ApiOperation(value = "日志列表")
    @PostMapping("/list")
    public CommonResponse<PageUtil<OperationLogResponse>> list (@RequestBody OperationLogRequest request){
        return CommonResponse.success(operationLogService.getList(request));

    }

    @ApiOperation(value = "日志操作列表")
    @GetMapping("/type/list")
    public CommonResponse<Object> typeList (){
        return CommonResponse.success(operationLogService.getTypeList());

    }


    @ApiOperation(value = "关闭报警声音日志")
    @GetMapping("/shutDown")
    public CommonResponse<String> saveShutDownOperation (@RequestParam
          @ApiParam(value = "操作编码,34-驾驶舱-手动，38-驾驶舱-系统， 36-平台手动， 39-平台系统") Integer operationCode){
        operationLogService.saveShutDownOperation(operationCode);
        return CommonResponse.success("success");

    }

}
